PROGRAMMING THE HARDWARE

Overview

When the program has been written, the front panel designed and the system simulated and tested the final step is to program the physical hardware. You can do this directly from inside Proteus as discussed below.

Raspberry Pi 3

Raspberry Pi programming involves an initial, one time configuration phase and then a programming procedure that you follow every time you want to change the firmware.

Configuration

The one-time configuration process is documented in full in the Visual Designer manual and a short video tutorial is also available. Both are linked below.

Visual Designer Manual : Raspberry Pi Configuration

Tutorial Movie : Raspberry Pi Configuration

Programming

Once configured the actual act of programming is really simple and is documented in the Visual Designer manual as per the link below

Visual Designer Manual - Raspberry Pi Programming.

Proteus Playkit

With the Playkit powered on, you can connect your PC’s WiFi to the temporary Access Point that it has created.

 If you then point a web browser to the IP address 192.168.4.1 you should see a screen similar to the one below:

Click Configure WiFi and select your main WiFi network from the list. You will also need to enter the WiFi password if such is required:

If this screen does not show properly the first time, try refreshing page in your browser

The three fields at the bottom allow configuration of the appliance name, a time (NTP) server and a time offset in hours. You should set this last value to match your current time zone. When you are done, click save. The Playkit ESP8266 LED should blink for a short while and then become steady. This indicates a successful connection to your WiFi network and you are now ready to wire up the hardware.

Note that if the appliance fails to connect to the configured WiFi network at start up, it will automatically enter the end-user configuration mode. This makes it possible to re-configure the WiFi settings at a new location, or if either the SSID or password for your network is changed.

The hardware is now ready to be programmed from Proteus. Whereas the previous steps need to be carried out just the once, this last step can be repeated as many times as you like during the process of developing the appliance firmware. Of course, you can also simulate the appliance within Proteus VSM so, in most circumstances you would expect to deploy to the real hardware only right at the end of the software development process.

With your PC re-connected to your network, Open Proteus and select the New Flowchart option. Make sure you set the family to be Arduino and the controller to Playkit.

The resulting project will place an instance of the Playkit base board on the schematic for you. The port number can be set as you like and will be needed for both simulation and deployed use.

From the Visual Designer tab, go to the Project Menu > Project Settings to configure IoT Builder for programming. Change the Programmer option to ESP8266 and the Interface to ESP8266 on Arduino Uno. More options will now appear. The host option allows you to select the appropriate Playkit from those on your network. Each Playkit is uniquely named and has a sticker on the bottom identifying it.

This name is also the address to use when connecting a browser to the Playkit after deployment of the firmware in the format <name>:<port> e.g esp8266_1700ee.local:80

Once a project is ready to be deployed, it can be uploaded from the top control bar.

Proteus will give you the results of the process in the Output window.

If for any reason you are struggling to upload your firmware or cannot connect to the Playkit, please see the Troubleshooting section.

 

Arduino Yun

Arduino Yun via SSH

The Arduino Yún contains both an Atmel ATmega32u4 and an Atheros AR9331. Digital pins Digital pins 0 and 1 are used for serial communication between the two processors.  Your program firmware will execute on the Atmel CPU while the Atheros processor (running Linux) will host the webserver, front panel controls and associated IOT resources.

It is important at this point to make sure that your Yun and your PC are on the same wireless network. If this is a Yun 'straight out of the box' you and the Arduino is plugged in to a power source, it will appear under your WiFi settings as "Arduino-Yun-XXXXXXX" where XXXXXXX is the serial number of the Yun.

Configuration of the project for programming takes place from the project settings dialogue. First launch the dialogue form either from the Build menu or from the icon at the top of the editor.

Next, set the programmer to be Yun SSH and the interface to be SSH.

The default address, user and pass are pre-populated but will need changing if the configuration of your device has been changed. If they have been changed you will need to type in the name of the host (arduino.local.) in to a browser, enter in the password and change and then in the settings set up the Arduino correctly.

After configuration, make sure the Yun device is switched on and is out of reset and then program via the button at the top of the editor.

You will see progress updates in the output window as programming takes place - note that, depending on the size of the resources involved, this could take a little time.

How does it work ?

When you press the program button the following actions take place:

1) The resources are transferred to the target path folder (/vsm by default) on the Atheros.

2) The firmware is transferred to the /tmp folder on the Atheros.

3) AVR-DUDE is invoked (on the Yun side) to program the firmware into the AVR. It does this using the ICP interface (SPI).

 

Arduino Yun via USB

Similarly to the SSH method or programming, configuration of the project takes place from the project settings dialogue. First launch the dialogue form either from the Build menu or from the icon at the top of the editor.

Set the programmer to be LEODUDE and the interface to be Arduino Yun.

At this point the only other fields available are the Port and the Speed. The port will be whatever your PC creates for you. i.e. COM4. If there are more than one COM ports in the list, you can find which one the Yun is using from the Windows Device Manager.

The port speed by default for the Yun is 57600 bps.

After configuration, make sure the Yun device is switched on and is out of reset and then program via the button at the top of the editor.

You will see progress updates in the output window as programming takes place - note that, depending on the size of the resources involved, this could take a little time.

How does it work ?

When you press the program button the following actions take place:

1) The bootloader on the AVR will be used to pass all of the resources across the data bridge to the Atheros chip.

2) Resources will be deposited in the target path folder (/vsm by default).

3) AVRDUDE on the PC will be invoked to program the firmware onto the AVR processor.

 

Computer / Network / Lab Setup

Depending on the features of your computer and/or the number of PC's and Yun boards in the room It may be necessary to do some configuration.

1) If a PC has wi-fi then it can connect to the Yun directly via the procedure described above. The MAC address for the Yun (normally found as a sticker on the shield/board) will be appended as part of the device name allowing you to identify it.

2) If the PC's do not have wi-fi then some configuration is going to be needed. We'd suggest you have a wireless access point/router connected to the office/class LAN. Plug the Yun in to the network and it will obtain a dynamic IP address from a DHCP server. After that, you should be able to see the Yun hardware from the PC and program according to the procedure above.

3) Alternatively, you can cable the individual Yun boards to the PC's and program via USB as described above. Assuming the Yun is in default configuration (Access point) then the phones / tablets will connect to the real hardware after programming. You may end up with a lot of micro-networks (mobile device and Yun) and people will have to check mac addresses to connect to the correct Yun but it will work fine.

4) If all fails remember that you don't need each computer to program physical hardware. Proteus VSM has complete simulation and debug of the electronics and the front panel so a single programming station is both common and perhaps more practical.

If you are using an Access point bear in mind that the wifi on the Yun baseboard is fairly poor and, with a noisy network, the accessible range between the device and the access point may be short. Our experience is that a Yun shield on an Uno board is better than a Yun baseboard but see also note 3) above.

Note that In some countries, it is prohibited to sell WiFi enabled devices without government approval. While waiting for proper certification, some local distributors are disabling WiFi functionality. Needless to say, this will prevent the programming of the Yun via this method and also render is useless as an internet of things appliance. Check with your dealer before purchasing a Yún if you believe you may live in such a country.

Setting The Arduino Yun On To Your Network

1) Power the Yun with a USB cable

2) Plug an ethernet cable in from your router / network point

3) Open a web browser and type in its host: arduino.local.' (including the last full stop). This will prompt you for a password

4) Enter the password: arduino or doghunter to enter the Arduino's settings

5) If the Arduino Configuration Wizard does not appear automatically, click on the Arduino Applications icon

6) Go to the Utilities > Config Wizard

7) Click Next until you reach the Wireless settings page

8) Select your network from the list

9) The security will be automatically selected and you can enter in the password of your Wireless connection as you would if you were connecting your phone to the same network.

10) Click next until you get the save option, and save. Your Arduino is now connected to your network and will automatically connect to it when turned on.

Arduino Uno + ESP8266

Programming the WeMOSD1  will only work once the hardware has been assembled and the ESP8266 has been re-flashed with the Labcenter VFP Server. A full setup guide is provided via the link below:

Building an ESP8266 Server

 

MicroPython (Pico / ESP32 / Pyboard)

Projects created with the MicroPython family generate MicroPython code and resources. After simulation and testing, the code can be deployed to the physical board using the standard Visual Designer programming workflow for the selected target. Once running on hardware, the same IoT Builder panel is available over the network via the Proteus mobile app.